package com.blustreaksw.cyclecoach.history;

import java.util.ArrayList;
import java.util.UUID;
import android.content.Context;
import com.blustreaksw.cyclecoach.R;

public class WorkoutHistoryContainer {
    private ArrayList<WorkoutLogEntry> mWorkoutHistory;

    private static WorkoutHistoryContainer sWorkoutHistoryContainer;
    private Context mAppContext;

    private WorkoutHistoryContainer(Context appContext) {
        mAppContext = appContext;
        mWorkoutHistory = new ArrayList<WorkoutLogEntry>();
        /*for (int i = 0; i < 100; i++) {
        	WorkoutLogEntry w = new WorkoutLogEntry();
            w.setLogEntryNumber(i + 1);
            w.setLogEntryCount(100);
            mWorkoutHistory.add(w);
        }*/
    }

    public static WorkoutHistoryContainer get(Context c) {
        if (sWorkoutHistoryContainer == null) {
        	sWorkoutHistoryContainer = new WorkoutHistoryContainer(c.getApplicationContext());
        }
        
        return sWorkoutHistoryContainer;
    }

    public WorkoutLogEntry getLogEntry(UUID id) {
        for (WorkoutLogEntry w : mWorkoutHistory) {
            if (w.getId().equals(id))
                return w;
        }
        return null;
    }
    
    public ArrayList<WorkoutLogEntry> getAllLogEntries() {
        return mWorkoutHistory;
    }
}
